home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93b.txt / 000101_icon-group-sender _Mon May 17 17:46:22 1993.msg < prev    next >
Internet Message Format  |  1993-06-16  |  4KB

  1. Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 17 May 1993 09:19:17 MST
  2. Received: by owl.cs.arizona.edu; Mon, 17 May 1993 09:19:15 MST
  3. Date: Mon, 17 May 93 17:46:22 +0200
  4. From: karczma@univ-caen.fr (Jerzy Karczmarczuk)
  5. Message-Id: <9305171546.AA02842@univ-caen.fr>
  6. To: icon-group@cs.arizona.edu
  7. Subject: Re: Icon vs Prolog?
  8. Status: R
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10.  
  11. Boris Borcic asked:
  12.  
  13. >>I have read in this group that Icon uses a backtracking
  14. >>mechanism very similar to Prolog. Would a user of both
  15. >>languages care to sketch Icon with Prolog as background ?
  16. >>What are the most significant differences ?
  17.  
  18. ... and Dave Schaumann <dave@cs.arizona.edu> replied
  19.  
  20. > Probably the most significant difference is that Icon is a (mostly)
  21. > imperative language.  Thus, most Icon programs tend to be (mostly)
  22. > imperative.
  23. ...
  24.  
  25. > It's been a long time since I did any Prolog programming, so I can't
  26. > speak directly to the relative strengths of each language, but I wouldn't
  27. > be to surprised if one could write a fairly complete Prolog interpreter
  28. > in Icon with relatively few lines of code (particularly since you have the
  29. > backtracking feature "for free").
  30.                                  * * *
  31.  
  32. Gentlemen, as you know, the discussion about programming languages is
  33. like the old machos's memoirs about women: they are all the same, but it
  34. is better not to replace one by another too often, if you want really to
  35. learn something.
  36.  
  37. Actually I would call Icon rather a functional language than imperative.
  38.  
  39. 1. Everything is an expression, the assignment and other control
  40.    structures included. (Well, OK, ALMOST everything, I know...)
  41. 2. You can store procedure (identifiers) and pass them as data, and then
  42.    call them anywhere.
  43. 3. You can define local lexical closures, or "thunks", and calling them
  44.    "co-expressions" doesn't change much.
  45. 4. co-exs (as generators) can be used to implement streams and other
  46.    lazy structures, so you are not too far from Lazy Functionalists.
  47.    Btw., this is a fascinating project for your students!
  48.  
  49. It is probably easier to implement Prolog in Icon than in Lisp, but
  50. I wouldn't say that the Prolog backtracking is for free. You have to take
  51. into account that implementing Prolog means installing data structures
  52. which will emulate Prolog variables. And the backtracking in Prolog is not
  53. just the control backtracking, but total data amnesia as well. It is not
  54. straightforward to implement, but if you know the rules, you don't need the 
  55. non-deterministic facilities in the implementation language.
  56.  
  57. I would not agree completely with Richard Goerwitz who claims ... that
  58. in Icon ...
  59.  
  60. > You can write programs
  61. > that function solely by something analogous to term unification,
  62. > and the like.
  63.  
  64. A. Don't forget that unification is a two-way pattern matching, absent
  65.    in Icon, unless the concept of "something analogous" is somehow
  66.    abused.
  67. B. It is difficult to rewrite in Icon some Prolog clauses which profit
  68.    from the fact that you can store a non-instantiated variable, and
  69.    instantiate it afterwards. Sometimes it is possible, as de-referencing
  70.    in Icon is deferred, and the concept of datum which is VARIABLE
  71.    exists, but how many Icon users understand well the need and the
  72.    usage of the "." operator? (Frankly, I don't...)
  73.  
  74. (Just for the Guru himself: I think it is a light perversion to use for
  75.  the dereferencing operator the same symbol which has been used in Snobol4
  76.  to denote just the reverse of it, i.e. 'name'...)
  77.  
  78. Anyway, I love both languages (and a dozen others as well, like an old
  79. programming-language Don Juan) and living (for some time) in France, the
  80. country which is the mother of such international calamities as Prolog,
  81. Armagnac, Eiffel (the language and the tower, don't know which one is
  82. uglier...) 
  83. I permit myself to shout: "Vivent les petites differences!"
  84.  
  85. Jerzy Karczmarczuk                     Dept. of Computer Sci.
  86.                                        University of Caen, France
  87.                                        karczma@univ-caen.fr
  88.  
  89.  
  90.  
  91.